package net.nagaseyasuhito.kinsenka.wicket.page;

import net.nagaseyasuhito.kinsenka.persist.entity.Task;

import org.apache.wicket.authroles.authorization.strategies.role.Roles;
import org.apache.wicket.authroles.authorization.strategies.role.annotations.AuthorizeInstantiation;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.basic.MultiLineLabel;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.CompoundPropertyModel;

@AuthorizeInstantiation(Roles.USER)
public class ViewTaskPage extends BasePage {
	private static final long serialVersionUID = 1L;

	private Task task;

	public ViewTaskPage(Task task) {
		this.setDefaultModel(new CompoundPropertyModel<ViewTaskPage>(this));
		this.task = task;

		this.add(new Label("task.subject"));
		// this.add(new Label("task.updateTimestamp"));
		// this.add(new Label("task.createTimestamp"));
		this.add(new MultiLineLabel("task.detail"));

		this.add(new Link<Void>("modify") {
			private static final long serialVersionUID = 1L;

			@Override
			public void onClick() {
				this.setResponsePage(new ModifyTaskPage(ViewTaskPage.this.task));
			}
		});
	}
}
